<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/inc/taglib.inc"%>
<%@ include file="/WEB-INF/inc/script.inc"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<base href="${base}">
<title>中金通 | 产品审核</title>

<link href="css/bootstrap.min.css" rel="stylesheet">
<link href="font-awesome/css/font-awesome.css" rel="stylesheet">

<!-- Data Tables -->
<link href="css/plugins/dataTables/dataTables.bootstrap.css"
	rel="stylesheet">
<link href="css/plugins/dataTables/dataTables.responsive.css"
	rel="stylesheet">
<link href="css/plugins/dataTables/dataTables.tableTools.min.css"
	rel="stylesheet">

<link href="css/animate.css" rel="stylesheet">
<link href="css/style.css" rel="stylesheet">

<link href="css/plugins/datapicker/datepicker3.css" rel="stylesheet">

<style type="text/css">
textarea {
	resize: none;
}
</style>
</head>

<body>

	<div id="wrapper">

		<!-- 左侧菜单 -->
		<jsp:include page="/WEB-INF/jsp/common/main-menu.jsp"></jsp:include>

		<div id="page-wrapper" class="gray-bg">
			<div class="row border-bottom">
				<!-- 头部工具栏区 -->
				<jsp:include page="/WEB-INF/jsp/common/main-header.jsp"></jsp:include>
			</div>
			<div class="row wrapper border-bottom white-bg page-heading">
				<div class="col-lg-10">
					<h2>产品管理</h2>
					<ol class="breadcrumb">
						<li><a href="common/platform">Home</a></li>
						<li><a href="product/list">产品管理</a></li>
						<li><a href="product/listAudit">产品审核</a></li>
						<li><a href="product/audit/${product.id}">${product.briefName}</a>
						</li>
						<li class="active"><strong>审核</strong></li>
					</ol>
				</div>
				<div class="col-lg-2"></div>
			</div>

			<div class="row" style="margin-top: 10px;">
				<div class="col-md-12">
					<div class="tabs-container">
						<ul class="nav nav-tabs">
							<li><a href="product/listAudit"> 产品审核列表 </a></li>
							<li class="active"><a> 产品审核 </a></li>
						</ul>
						<div class="tab-content">
							<div class="tab-pane active">
								<div class="panel-body">
									<div
										class="wrapper wrapper-content animated fadeInRight ecommerce">
										<div>
											<!-- class="ibox-content" -->
											<form method="post" id="addForm"
												enctype="multipart/form-data" class="form-horizontal">
												<!-- action="employee/doAdd" -->

												<%-- <div class="row">
									                    <div class="col-sm-6">
									                        <div class="form-group">
									                            <label class="col-sm-4 control-label"><button class="btn btn-w-m btn-primary" type="button" onclick='javascript:window.location.href = "product/edit/${product.id}"'>编辑</button>          </label>
						                                        <div class="col-sm-8">
						                                    	   
						                                        </div>
									                        </div>
									                    </div> 
									                    
									                    <div class="col-sm-6">
									                        <div class="form-group">
									                        	<label class="col-sm-2 control-label"></label>
						                                        <div class="col-sm-8">
						                                    	   
						                                        </div>
									                        </div>
									                    </div>
									                 </div> --%>



												<%--  <div class="form-group">
						                                    <div class="col-sm-4 col-sm-offset-5">
						                                        <button class="btn btn-w-m btn-primary" type="button" onclick='javascript:window.location.href = "product/edit/${product.id}"'>编辑</button>
						                                        <!-- <button class="btn btn-white" type="reset">取 消</button> -->
						                                    </div>
						                                </div> --%>
												<input type="text" id="productId" name="id"
													style="display: none" value="${product.id}">

												<!--Detail form start-->
												<div class="row">
													<div class="col-sm-6">
														<div class="form-group">
															<label class="col-sm-4 control-label">产品代码</label>
															<div class="col-sm-8">
																<input readonly
																	style="border: 0px; background: #0f0; background-color: transparent;"
																	type="text" name="productCode" class="form-control"
																	value="${product.productCode}">
															</div>
														</div>
													</div>

													<div class="col-sm-6">
														<div class="form-group">
															<label class="col-sm-2 control-label">认购费/申购费</label>
															<!--统一用subFee  -->
															<div class="col-sm-8">
																<input readonly
																	style="border: 0px; background: #0f0; background-color: transparent;"
																	type="text" name="subFee" class="form-control"
																	value='<fmt:formatNumber value="${product.subFee}" pattern="0.00%"/>'>
															</div>
														</div>
													</div>
												</div>
												<!-- <div class="hr-line-dashed"></div> -->
												<div class="row">
													<div class="col-sm-6">
														<div class="form-group">
															<label class="col-sm-4 control-label">产品全称</label>
															<div class="col-sm-8">
																<input readonly
																	style="border: 0px; background: #0f0; background-color: transparent;"
																	type="text" name="productName" class="form-control"
																	value="${product.productName}">
															</div>
														</div>
													</div>
													<div class="col-sm-6">
														<div class="form-group">
															<label class="col-sm-2 control-label">支付手续费</label>
															<div class="col-sm-8">
																<input readonly
																	style="border: 0px; background: #0f0; background-color: transparent;"
																	type="text" name="handlingFee" class="form-control"
																	value='<fmt:formatNumber value="${product.handlingFee}" pattern="##,###,###,###,##0.00 元"/>'>
															</div>
														</div>
													</div>
												</div>
												<!--  <div class="hr-line-dashed"></div> -->
												<div class="row">
													<div class="col-sm-6">
														<div class="form-group">
															<label class="col-sm-4 control-label">产品简称</label>
															<div class="col-sm-8">
																<input readonly
																	style="border: 0px; background: #0f0; background-color: transparent;"
																	type="text" name="briefName" class="form-control"
																	value="${product.briefName}">
															</div>
														</div>
													</div>
													<div class="col-sm-6">
														<div class="form-group">
															<label class="col-sm-2 control-label">开放日</label>
															<div class="col-sm-8">
																<input readonly
																	style="border: 0px; background: #0f0; background-color: transparent;"
																	id="openDate" type="text" name="openDate"
																	class="form-control"
																	value="${product.openDate==null?'--':product.openDate}">
															</div>
														</div>
													</div>
												</div>
												<!-- <div class="hr-line-dashed"></div> -->
												<div class="row">
													<div class="col-sm-6">
														<div class="form-group">
															<label class="col-sm-4 control-label">收益类型</label>
															<div class="col-sm-8">
																<input readonly
																	style="border: 0px; background: #0f0; background-color: transparent;"
																	type="text" id="incomeType" name="incomeType"
																	class="form-control" value="${product.incomeType}">
																<!-- <select disabled="disabled" style="border:0px;background:#0f0;background-color:transparent;" id="incomeType" class="form-control m-b" name="incomeType" >
										                              <option value="">所有</option>
										                              <option value="0">固定</option>
										                              <option value="1">浮动</option>
										                              <option value="2">固定+浮动</option>
										                           </select>  -->
															</div>
														</div>
													</div>
													<div class="col-sm-6">
														<div class="form-group">
															<label class="col-sm-2 control-label">开放周期</label>
															<div class="col-sm-8">
																<input readonly
																	style="border: 0px; background: #0f0; background-color: transparent;"
																	type="text" name="openCycle" class="form-control"
																	value="${product.openCycle==null?'--':product.openCycle}">
															</div>
														</div>
													</div>
												</div>
												<!-- <div class="hr-line-dashed"></div> -->
												<div class="row">
													<div class="col-sm-6">
														<div class="form-group">
															<label class="col-sm-4 control-label">投资规模</label>
															<div class="col-sm-8">
																<input readonly
																	style="border: 0px; background: #0f0; background-color: transparent;"
																	type="text" name="scale" class="form-control"
																	value='<fmt:formatNumber value="${product.scale}" pattern="##,###,###,###,##0.00 元"/>'>
															</div>
														</div>
													</div>
													<div class="col-sm-6">
														<div class="form-group">
															<label class="col-sm-2 control-label">赎回费</label>
															<div class="col-sm-8">
																<input readonly
																	style="border: 0px; background: #0f0; background-color: transparent;"
																	type="text" id="redeemFee" name="redeemFee"
																	class="form-control"
																	value='<fmt:formatNumber value="${product.redeemFee}" pattern="0.00%"/>'>
															</div>
														</div>
													</div>
												</div>
												<!-- <div class="hr-line-dashed"></div> -->
												<div class="row">
													<div class="col-sm-6">
														<div class="form-group">
															<label class="col-sm-4 control-label">投资期限</label>
															<div class="col-sm-8">
																<input readonly
																	style="border: 0px; background: #0f0; background-color: transparent;"
																	type="text" name="duration" class="form-control"
																	value="${product.duration}&nbsp;月">
															</div>
														</div>
													</div>
													<div class="col-sm-6">
														<div class="form-group">
															<label class="col-sm-2 control-label">管理费</label>
															<div class="col-sm-8">
																<input readonly
																	style="border: 0px; background: #0f0; background-color: transparent;"
																	type="text" id="manageFee" name="manageFee"
																	class="form-control"
																	value='<fmt:formatNumber value="${product.manageFee}" pattern="0.00%"/>'>
															</div>
														</div>
													</div>
												</div>
												<!-- <div class="hr-line-dashed"></div> -->
												<div class="row">
													<div class="col-sm-6">
														<div class="form-group">
															<label class="col-sm-4 control-label">招募开始时间</label>
															<div class="col-sm-8">
																<input readonly
																	style="border: 0px; background: #0f0; background-color: transparent;"
																	id="recruitStartTime" type="text"
																	name="recruitStartTime" class="form-control"
																	value='<fmt:formatDate value="${product.recruitStartTime}" pattern="yyyy-MM-dd"/>'>
															</div>
														</div>
													</div>
													<div class="col-sm-6">
														<div class="form-group">
															<label class="col-sm-2 control-label">收益分配</label>
															<div class="col-sm-8">
																<input readonly
																	style="border: 0px; background: #0f0; background-color: transparent;"
																	type="text" name="incomeDivide" class="form-control"
																	value="${product.incomeDivide==null?'--':product.incomeDivide}">
															</div>
														</div>
													</div>
												</div>
												<!-- <div class="hr-line-dashed"></div> -->
												<div class="row">
													<div class="col-sm-6">
														<div class="form-group">
															<label class="col-sm-4 control-label">集资对象</label>
															<div class="col-sm-8">
																<input readonly
																	style="border: 0px; background: #0f0; background-color: transparent;"
																	type="text" name="fundRaising" class="form-control"
																	value="${product.fundRaising}">
															</div>
														</div>
													</div>
													<div class="col-sm-6">
														<div class="form-group">
															<label class="col-sm-2 control-label">招募截止时间</label>
															<div class="col-sm-8">
																<input readonly
																	style="border: 0px; background: #0f0; background-color: transparent;"
																	id="recruitEndTime" type="text" name="recruitEndTime"
																	class="form-control"
																	value='<fmt:formatDate value="${product.recruitEndTime}" pattern="yyyy-MM-dd"/>'>
															</div>
														</div>
													</div>
												</div>
												<!-- <div class="hr-line-dashed"></div> -->
												<div class="row">
													<div class="col-sm-6">
														<div class="form-group">
															<label class="col-sm-4 control-label">运作方式</label>
															<div class="col-sm-8">
																<input readonly
																	style="border: 0px; background: #0f0; background-color: transparent;"
																	type="text" id="operationMode" name="operationMode"
																	class="form-control" value="${product.operationMode}">
																<!-- <select disabled="disabled" style="border:0px;background:#0f0;background-color:transparent;" id="operationMode" class="form-control m-b" name="operationMode" >
										                              <option value="">所有</option>
										                              <option value="0">开放式</option>
										                              <option value="1">封闭式</option>
										                           </select> -->
															</div>
														</div>
													</div>
													<div class="col-sm-6">
														<div class="form-group">
															<label class="col-sm-2 control-label">预期收益</label>
															<div class="col-sm-8">
																<input readonly
																	style="border: 0px; background: #0f0; background-color: transparent;"
																	type="text" name="prospectiveEarnings"
																	class="form-control"
																	value="${product.prospectiveEarnings}">
															</div>
														</div>
													</div>
												</div>
												<!-- <div class="hr-line-dashed"></div> -->
												<div class="row">
													<div class="col-sm-6">
														<div class="form-group">
															<label class="col-sm-4 control-label">基金管理人</label>
															<div class="col-sm-8">
																<input readonly
																	style="border: 0px; background: #0f0; background-color: transparent;"
																	type="text" name="fundManager" class="form-control"
																	value="${product.fundManager}">
															</div>
														</div>
													</div>
													<div class="col-sm-6">
														<div class="form-group">
															<label class="col-sm-2 control-label">产品承销</label>
															<div class="col-sm-8">
																<input readonly
																	style="border: 0px; background: #0f0; background-color: transparent;"
																	type="text" name="underWriter" class="form-control"
																	value="${product.underWriter}">
															</div>
														</div>
													</div>
												</div>
												<!-- <div class="hr-line-dashed"></div> -->
												<div class="row">
													<div class="col-sm-6">
														<div class="form-group">
															<label class="col-sm-4 control-label">基金托管人</label>
															<div class="col-sm-8">
																<input readonly
																	style="border: 0px; background: #0f0; background-color: transparent;"
																	type="text" name="fundTrustee" class="form-control"
																	value="${product.fundTrustee}">
															</div>
														</div>
													</div>
													<div class="col-sm-6">
														<div class="form-group">
															<label class="col-sm-2 control-label">基金投向</label>
															<div class="col-sm-8">
																<input readonly
																	style="border: 0px; background: #0f0; background-color: transparent;"
																	type="text" name="fundInvest" class="form-control"
																	value="${product.fundInvest}">
															</div>
														</div>
													</div>
												</div>
												<!-- <div class="hr-line-dashed"></div> -->
												<div class="row">
													<div class="col-sm-6">
														<div class="form-group">
															<label class="col-sm-4 control-label">投资起点</label>
															<div class="col-sm-8">
																<input readonly
																	style="border: 0px; background: #0f0; background-color: transparent;"
																	type="text" name="subStart" class="form-control"
																	value='<fmt:formatNumber value="${product.subStart}" pattern="##,###,###,###,##0.00 元"/>'>
															</div>
														</div>
													</div>
													<div class="col-sm-6">
														<div class="form-group">
															<label class="col-sm-2 control-label">咨询电话</label>
															<div class="col-sm-8">
																<input readonly
																	style="border: 0px; background: #0f0; background-color: transparent;"
																	type="text" name="consultPhone" class="form-control"
																	value="${product.consultPhone}">
															</div>
														</div>
													</div>
												</div>
												<!-- <div class="hr-line-dashed"></div> -->
												<div class="row">
													<div class="col-sm-6">
														<div class="form-group">
															<label class="col-sm-4 control-label">开户行</label>
															<div class="col-sm-8">
																<input readonly
																	style="border: 0px; background: #0f0; background-color: transparent;"
																	type="text" name="bankDeposit" class="form-control"
																	value="${product.bankDeposit}">
															</div>
														</div>
													</div>
													<div class="col-sm-6">
														<div class="form-group">
															<label class="col-sm-2 control-label">递增金额</label>
															<div class="col-sm-8">
																<input readonly
																	style="border: 0px; background: #0f0; background-color: transparent;"
																	type="text" name="increaseAmount" class="form-control"
																	value='<fmt:formatNumber value="${product.increaseAmount}" pattern="##,###,###,###,##0.00 元"/>'>
															</div>
														</div>
													</div>
												</div>
												<!-- <div class="hr-line-dashed"></div> -->
												<div class="row">
													<div class="col-sm-6">
														<div class="form-group">
															<label class="col-sm-4 control-label">企业银行账户</label>
															<div class="col-sm-8">
																<input readonly
																	style="border: 0px; background: #0f0; background-color: transparent;"
																	type="text" name="bankAccount" class="form-control"
																	value="${product.bankAccount}">
															</div>
														</div>
													</div>
													<div class="col-sm-6">
														<div class="form-group">
															<label class="col-sm-2 control-label">开户名</label>
															<div class="col-sm-8">
																<input readonly
																	style="border: 0px; background: #0f0; background-color: transparent;"
																	type="text" name="bankName" class="form-control"
																	value="${product.bankName}">
															</div>
														</div>
													</div>
												</div>
												<!-- <div class="hr-line-dashed"></div> -->
												<div class="row">
													<div class="col-sm-6">
														<div class="form-group">
															<label class="col-sm-4 control-label">排序值</label>
															<div class="col-sm-8">
																<input readonly
																	style="border: 0px; background: #0f0; background-color: transparent;"
																	type="text" name="orders" class="form-control"
																	value="${product.orders}">
															</div>
														</div>
													</div>
													<div class="col-sm-6">
														<div class="form-group">
															<label class="col-sm-2 control-label">产品状态</label>
															<div class="col-sm-8">
																<input readonly
																	style="border: 0px; background: #0f0; background-color: transparent;"
																	type="text" id="state" name="state"
																	class="form-control" value="${product.state}">
																<!-- <select disabled="disabled" style="border:0px;background:#0f0;background-color:transparent;" id="state" class="form-control m-b" name="state" >
										                              <option value="">所有</option>
										                              <option value="0">即将上线</option>
							                                          <option value="1">正在募集中</option>
							                                          <option value="2">募集完成</option>
										                           </select> -->
															</div>
														</div>
													</div>
												</div>
												<!-- <div class="hr-line-dashed"></div> -->
												<div class="row">
									                    <div class="col-sm-6">
									                        <div class="form-group">
									                            <label class="col-sm-4 control-label">产品评级</label>
						                                        <div class="col-sm-8">
						                                    	   <input readonly style="border:0px;background:#0f0;background-color:transparent;" type="text" name="level" class="form-control" value="${product.level}">
						                                        </div>
									                        </div>
									                    </div>
									                    <div class="col-sm-6">
									                        <div class="form-group">
									                        	<label class="col-sm-2 control-label">合同编号前缀</label>
						                                        <div class="col-sm-8">
						                                    	   <input readonly style="border:0px;background:#0f0;background-color:transparent;" type="text" name="contactPrefix" class="form-control" value="${product.contactPrefix}">
						                                        </div>
									                        </div>
									                    </div>
									                 </div>
												<!-- <div class="hr-line-dashed"></div> -->
												<div class="row">
													<div class="col-sm-6">
														<div class="form-group">
															<label class="col-sm-4 control-label">产品图片</label>
															<div class="col-sm-8">
																<%-- <input readonly style="border:0px;background:#0f0;background-color:transparent;" type="text" name="thumbnail" class="form-control"  value="${product.thumbnail}"> --%>
																<a title="Image from Unsplash" data-gallery=""><img
																	style="width: 400px; height: 300px"
																	src="${imagePrefix}${product.thumbnail}"></a>
																<!-- 选择文件:<input readonly style="border:0px;background:#0f0;background-color:transparent;" type="file" name="file"><button type="button" id="uploadImageBtn" class="btn btn-outline btn-primary">上传</button> -->
															</div>
														</div>
													</div>
												</div>
												<!-- <div class="hr-line-dashed"></div> -->
												<div class="row">
													<div class="col-sm-6">
														<div class="form-group">
															<label class="col-sm-4 control-label">投资范围</label>
															<div class="col-sm-8">
																<textarea readonly
																	style="border: 0px; background: #0f0; background-color: transparent;"
																	id="investScope" name="investScope"
																	class="form-control" rows="10">${product.investScope}</textarea>
															</div>
														</div>
													</div>
												</div>
												<!-- <div class="hr-line-dashed"></div> -->
												<div class="row">
													<div class="col-sm-6">
														<div class="form-group">
															<label class="col-sm-4 control-label">产品档次</label>
															<div class="col-sm-8">
																<table id="modelEditable"
																	class="table table-striped table-bordered table-hover">
																	<thead>
																		<tr>
																			<th>档次</th>
																			<th>认购范围</th>
																			<th>预期收益</th>
																			<!-- <th style="background-color:white;">操作</th> -->
																		</tr>
																	</thead>
																	<tbody>

																	</tbody>
																</table>
															</div>
														</div>
													</div>
												</div>
												<!-- <div class="hr-line-dashed"></div> -->
												<div class="row">
													<div class="col-sm-6">
														<div class="form-group">
															<label class="col-sm-4 control-label">风控措施</label>
															<div class="col-sm-8">
																<textarea readonly
																	style="border: 0px; background: #0f0; background-color: transparent;"
																	id="riskControl" name="riskControl"
																	class="form-control" rows="10">${product.riskControl}</textarea>
															</div>
														</div>
													</div>
												</div>
												<!-- <div class="hr-line-dashed"></div> -->
												<div class="row">
													<div class="col-sm-6">
														<div class="form-group">
															<label class="col-sm-4 control-label">备注</label>
															<div class="col-sm-8">
																<textarea readonly
																	style="border: 0px; background: #0f0; background-color: transparent;"
																	id="remark" name="remark" class="form-control"
																	rows="10">${(product.remark==null||product.remark=='')?'--':product.remark}</textarea>
															</div>
														</div>
													</div>
												</div>
												<!-- <div class="hr-line-dashed"></div> -->
												<div class="row">
													<div class="col-sm-6">
														<div class="form-group">
															<label class="col-sm-4 control-label">产品合同</label>
															<div class="col-sm-8">
																<input id="contactFile" readonly
																	style="border: 0px; background: #0f0; background-color: transparent;"
																	type="text" name="contactFile" class="form-control"
																	value="${product.contactFile}">
																<%-- <a  href="product/downloadFile?filePath=${product.contactFile}" title="Image from Unsplash" data-gallery="">${product.contactFile}</a>  --%>
															</div>
														</div>
													</div>
												</div>
												<!-- <div class="hr-line-dashed"></div> -->
												<div class="row">
													<div class="col-sm-6">
														<div class="form-group">
															<label class="col-sm-4 control-label">产品附件</label>
															<div class="col-sm-8" id="relatedFileId">
																<input readonly
																	style="border: 0px; background: #0f0; background-color: transparent;"
																	type="text" class="form-control">
																<%-- <a  href="product/downloadFile?filePath=${product.contactFile}" title="Image from Unsplash" data-gallery="">${product.contactFile}</a>  --%>
															</div>
														</div>
													</div>
												</div>
												<!-- <div class="hr-line-dashed"></div> -->
												<div class="row">
													<div class="col-sm-6">
														<div class="form-group">
															<label class="col-sm-4 control-label">团队组长默认管理提成</label>
															<div class="col-sm-8">
																<input readonly
																	style="border: 0px; background: #0f0; background-color: transparent;"
																	type="text" name="defaultDividend" class="form-control"
																	value='<fmt:formatNumber value="${product.defaultDividend}" pattern="0.00%"/>'>
															</div>
														</div>
													</div>
												</div>
												<!-- <div class="hr-line-dashed"></div> -->
												<div class="row">
													<div class="col-sm-6">
														<div class="form-group">
															<label class="col-sm-4 control-label">理财师默认佣金</label>
															<div class="col-sm-8">
																<input readonly
																	style="border: 0px; background: #0f0; background-color: transparent;"
																	type="text" name="defaultCommission"
																	class="form-control"
																	value='<fmt:formatNumber value="${product.defaultCommission}" pattern="0.00%"/>'>
															</div>
														</div>
													</div>
												</div>
												<!-- <div class="hr-line-dashed"></div> -->
												<div class="row">
													<div class="col-sm-6">
														<div class="form-group">
															<label class="col-sm-4 control-label">审核</label>
															<div class="col-sm-8">
																<select class="form-control m-b" id="auditState"
																	name="auditState">
																	<option value="0">审核未通过</option>
																	<option value="1">审核已通过</option>
																</select>
															</div>
														</div>
													</div>
												</div>
												<!-- <div class="hr-line-dashed"></div> -->
												<div class="form-group">
													<div class="col-sm-4 col-sm-offset-5">
														<button class="btn btn-primary" type="button"
															onclick='updateAudit()'>保存</button>
														<button class="btn btn-white" type="button" onclick="backList()">取 消</button>
													</div>
												</div>
											</form>
										</div>
									</div>
								</div>
							</div>
						</div>
					</div>
				</div>
			</div>

			<!-- 底部版权 -->
			<jsp:include page="/WEB-INF/jsp/common/main-footer.jsp"></jsp:include>

		</div>
	</div>

	<!-- Mainly scripts -->
	<script src="js/jquery-2.1.1.js"></script>
	<script src="js/bootstrap.min.js"></script>
	<script src="js/plugins/metisMenu/jquery.metisMenu.js"></script>
	<script src="js/plugins/slimscroll/jquery.slimscroll.min.js"></script>
	<script src="js/jquery.serialize-object.min.js" type="text/javascript"></script>
	<script src="js/plugins/validate/jquery.validate.min.js"
		type="text/javascript"></script>
	<!-- Custom and plugin javascript -->
	<script src="js/inspinia.js"></script>
	<script src="js/plugins/pace/pace.min.js"></script>
	<script src="js/plugins/bootbox/bootbox.min.js" type="text/javascript"></script>
	<!-- Data picker -->
	<script src="js/plugins/datapicker/bootstrap-datepicker.js"></script>

	<!-- Data Tables -->
	<script src="js/plugins/dataTables/jquery.dataTables.min.js"></script>
	<script src="js/plugins/dataTables/dataTables.bootstrap.js"></script>
	<script src="js/plugins/dataTables/dataTables.responsive.js"></script>
	<script src="js/plugins/dataTables/dataTables.tableTools.min.js"></script>

	<!-- 业务 -->
	<script src="js/ajaxfileupload.js"></script>
	<script src="js/product/product-grade-module.js"></script>
	<script src="js/product/FormatUtils.js"></script>

	<!-- Page-Level Scripts -->
	<script>
		$(document).ready(function() {
			ProductGradeModule.init();

			initSpecifiedContent();
			getRelatedFile();

		});
		function backList(){
			window.location.href = ctx +"/product/listAudit";
		}
		function updateAudit() {
			var productAudit = $("#auditState").val();
			$.ajax({
				url : ctx + "/product/updateAudit",
				data: {"id":"${product.id}","auditState":productAudit},
				dataType : "json",
				success : function(data) {
					if (data.code == 1) {
						bootbox.dialog({
							message: "审核成功！",
							title: "温馨提示：",
							buttons: {
								main: {
									label: "确定",
									className: "btn btn-primary",
									callback: function() {
										window.location.href = 'product/listAudit';
									}
								}
							}
						});
					}else{
						bootbox.dialog({
							message: "审核失败！",
							title: "温馨提示：",
							buttons: {
								main: {
									label: "确定",
									className: "btn btn-primary",
									callback: function() {
										
									}
								}
							}
						});
					}
				},
				error : function(msg) {
					bootbox.alert(msg.message);
				}
			});
		}

		function initSpecifiedContent() {
			var incomeType = "";
			if ("${product.incomeType}" == 0) {
				incomeType = "固定";
			} else if ("${product.incomeType}" == 1) {
				incomeType = "浮动";
			} else if ("${product.incomeType}" == 2) {
				incomeType = "固定+浮动";
			}

			var operationMode = "";
			if ("${product.operationMode}" == 0) {
				operationMode = "开放式";
			} else if ("${product.operationMode}" == 1) {
				operationMode = "封闭式";
			}

			var state = "";
			if ("${product.state}" == 0) {
				state = "即将上线";
			} else if ("${product.state}" == 1) {
				state = "正在募集中";
			} else if ("${product.state}" == 2) {
				state = "募集完成";
			}
			$("#incomeType").val(incomeType);
			$("#operationMode").val(operationMode);
			$("#state").val(state);
			/*  $("#riskControl").text("${product.riskControl}");
			$("#remark").text("${product.remark}");
			$("#investScope").text("${product.investScope}");  */
			$("#contactFile").val($("#contactFile").val().match(/[^\\/]*$/)[0]);

			if ("${product.redeemFee}" == "") {
				$("#redeemFee").val("--");
			}

			if ("${product.manageFee}" == "") {
				$("#manageFee").val("--");
			}
			$("#auditState").val("${product.auditState}");
		}

		function getRelatedFile() {
			$
					.ajax({
						type : "get",
						url : ctx + "/productAttachment/query/${product.id}",
						dataType : "json",
						success : function(data) {
							if (data.code == 1) {
								var objs = data.data.relatedFile;
								var html = '';

								for (var i = 0; i < objs.length; i++) {
									var fileName = objs[i].fileName;
									html += '<input readonly style="border:0px;background:#0f0;background-color:transparent;" type="text" class="form-control" value="'+fileName+'"/>';
								}

								if (html == '') {
									$("#relatedFileId")
											.html(
													'<input readonly style="border:0px;background:#0f0;background-color:transparent;" type="text" class="form-control" value="--"/>');
								} else {
									$("#relatedFileId").html(html);
								}

							}
						},
						error : function(msg) {
							bootbox.alert(msg.message);
						}
					});
		}
	</script>

</body>
</html>